<%-- 
    Document   : rollregister1
    Created on : 2019-7-11, 23:27:27
    Author     : dusin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>上传注册</title> 
        <link rel="stylesheet" type="text/css" href="../../js/jquery/themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="../../js/jquery/themes/icon.css">
        <link rel="stylesheet" type="text/css" href="../../css/demo.css">        
         <link rel="stylesheet" href="../../css/jquery.jsonview.css" />
        <script type="text/javascript" src="../../js/jquery/jquery-3.3.1.js"></script>
        <script type="text/javascript" src="../../js/jquery/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="../../js/jquery/jquery.jsonview.js"></script>
        <script>
            $(function() {
                $("#upload").click(function() {
                    $("#imgWait").show();
                    $("#uploadForm").form('submit', {
                        type: "post", //提交方式    
                        dataType: 'json',
                        url: "../../util/UploadExcelFile", //请求url
                        success: function(data) { //提交成功的回调函数   
                            var data = eval('(' + data + ')');
                            $.messager.alert({title: '提示',
                                msg: data[0].name+data[0].msg,
                                icon: 'info',
                            });
                            $("#imgWait").hide();
                            $("#json").JSONView(data);
                        },
                        error: function() {
                            alert("上传失败！");
                            $("#imgWait").hide();
                        }
                    });
                });

                $('#resultdg').datagrid('insertRow', {
                    index: 1, // index start with 0
                    row: {
                        name: 'new name',
                        age: 30,
                        note: 'some messages'
                    }
                });
            });
        </script>
    </head>
    <body>
        <div style="margin:20px 0;"></div>
        <div class="easyui-panel" title="上传平时成绩记录表注册" style="width:600px;padding:30px 70px 50px 70px">
            <form id="uploadForm" name="uploadForm"  enctype="multipart/form-data" method="post">
                <div style="margin-bottom:20px">
                    <div>文件:</div>
                    <input class="easyui-filebox" name="file1" id="file1"
                           data-options="prompt:'选中文件...',buttonText:'选择文件', accept:'application/vnd.ms-excel'" 
                           style="width:100%">
                </div>
            </form>
            <img src="../../img/gif/wait.gif"  
                 style="display:none" />
            <div>
                <a href="#" id="upload" class="easyui-linkbutton" style="width:100%">上传</a>
            </div>
        </div>
        <div id="json"></div>
        <!-下面表格显示上传文件处理情况-->
        <table id ="resultdg" class="easyui-datagrid" style="margin-top: 20">
            <thead>
                <tr>
                    <th data-options="field:'code'">Code</th>
                    <th data-options="field:'name'">Name</th>
                    <th data-options="field:'price'">Price</th>
                </tr>
            </thead>
          
        </table>
    </body>
</html>
